<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ page import="notice.*"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<!-- 상단프레임 -->
<%@ include file="/Dmyna/head.jsp"%>
<%@ include file="/Dmyna/myMenu.jsp"%>
<p>

<%
	String writeId = request.getParameter("id");
	NoticeWritingManager manager = NoticeWritingManager.getInstance();
	NoticeWriting writing = manager.select(Integer.parseInt(writeId));
%>

<c:set var="writing" value="<%=writing%>" />
<c:if test="${empty writing }">
	존재하지 않는 글입니다.
</c:if>
<c:if test="${!empty writing }">

	<table width="900" align="center" cellpadding="0" cellspacing="0">
		<tr>
			<td>
				<div style="clear: both; height: 30px;">
					<div style="float: left; margin-top: 6px;">
					
						<!-- 작성일 -->
						<img src="${WEB_ROOT }/img/bbs/icon_date.gif" align=absmiddle border='0'> 
						<span style="color: #888888;">작성일 : ${writing.bbs_date }</span>
						
					</div>
					
					<!-- 목록,수정,삭제,답글 버튼 -->
					<div style="float: right;">
						<a href="javascript:goList()">
							<img src='${WEB_ROOT }/img/bbs/btn_list.gif' border='0' align='absmiddle'></a> 
						<c:if test="${sessionScope.SESSION_MB_LEVEL == '10' }">
						<a href="javascript:goModify()">
							<img src='${WEB_ROOT }/img/bbs/btn_modify.gif' border='0' align='absmiddle'></a>
						<a href="javascript:goDelete()">
							<img src='${WEB_ROOT }/img/bbs/btn_delete.gif' border='0' align='absmiddle'></a> 
						<a href="javascript:goReply()">
							<img src='${WEB_ROOT }/img/bbs/btn_reply.gif' border='0' align='absmiddle'></a>
						</c:if>
					</div>
				</div>

				<div style="border:1px solid #ddd; clear:both; height:34px; background:url(${WEB_ROOT }/img/bbs/title_bg.gif) repeat-x;">
					<table border=0 cellpadding=0 cellspacing=0 width=100%>
						<tr>
							<td style="padding: 8px 0 0 10px;">
								<div
									style="color: #505050; font-size: 13px; font-weight: bold; word-break: break-all;">
									${writing.bbs_title }</div>
							</td>
							<td align="right" style="padding: 6px 6px 0 0;" width=120>&nbsp;</td>
						</tr>
					</table>
				</div>
				<div style="height:3px; background:url(${WEB_ROOT }/img/bbs/title_shadow.gif) repeat-x; line-height:1px; font-size:1px;"></div>

				<table border=0 cellpadding=0 cellspacing=0 width=900>
					<tr>
						<td height=30 background="${WEB_ROOT }/img/bbs/view_dot.gif" style="color: #888;">
							<div style="float: left;">&nbsp;글쓴이 : ${writing.mb_name }</div>
							<div style="float: right;">
								<img src="${WEB_ROOT }/img/bbs/icon_view.gif" border='0' align=absmiddle> 조회 : ${writing.bbs_view_cnt }&nbsp;
							</div>
						</td>
					</tr>

					<tr>
						<td height="150" style="word-break: break-all; padding: 10px;">
							<c:if test = "${!empty writing.bbs_img }">
							<img src="upload/${writing.bbs_img }"  width="50%"/><br />
							</c:if>
							<!-- 내용 출력 시작 -->
							<div style="height: 12px; line-height: 1px; font-size: 1px;">&nbsp;</div>
							<span id="writeContents" style="line-height: 200%;">${writing.bbs_content } </span> 
							<!-- 내용 출력 종료 -->
						</td>
					</tr>
				</table>

				<table width="900" height="1" border="0"
					cellspacing="0" cellpadding="0" class="top_menu">
					<tr>
						<td colspan=2 height=1 bgcolor=#e7e7e7></td>
					</tr>
					<tr>
						<td>
							<div style="clear: both; height: 30px;">
							
								<!-- 목록,수정,삭제,답글 버튼 -->
								<div style="float: right; margin-top: 6px;">
									<a href="javascript:goList()">
										<img src='${WEB_ROOT }/img/bbs/btn_list.gif' border='0'></a> 
									<c:if test="${sessionScope.SESSION_MB_LEVEL == '10' }">
									<a href="javascript:goModify()">
										<img src='${WEB_ROOT }/img/bbs/btn_modify.gif' border='0'></a> 
									<a href="javascript:goDelete()">	
										<img src='${WEB_ROOT }/img/bbs/btn_delete.gif' border='0'></a> 
									<a href="javascript:goReply()">
										<img src='${WEB_ROOT }/img/bbs/btn_reply.gif' border='0'></a>
									</c:if>
								</div>
							</div>
						</td>
					</tr>
				</table>
			</td>
		</tr>
	</table>
</c:if>

<!-- 하단프레임 -->
<%@ include file="/Dmyna/admin/tail.jsp"%>

<script language="JavaScript">
	function goReply() {
		document.move.action = "${WEB_ROOT }/notice/noticeWrite.jsp";
		document.move.submit();
	}

	function goModify() {
		document.move.action = "${WEB_ROOT }/notice/noticeUpdate.jsp";
		document.move.submit();
	}

	function goDelete() {
		if (confirm("글을 삭제하겠습니까?")) {
			document.move.action = "${WEB_ROOT }/notice/noticeDelete.jsp";
			document.move.submit();
		} else {
			
		}
	}

	function goList() {
		document.move.action = "${WEB_ROOT }/notice/MyNoticeList.jsp";
		document.move.submit();
	}
</script>

<form name="move" method="post">
	<input type="hidden" name="id" value="${writing.writing_id }" /> 
	<input type="hidden" name="parent_id" value="${writing.writing_id }" /> 
	<input type="hidden" name="group_id" value="${writing.group_id }" />
</form>


